﻿using System;
using System.ComponentModel;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using HitachiLib.Data;

namespace HitachiApp.Model
{
    public class MainPageModel : INotifyPropertyChanged
    {
        private ScheduleTabViewModel schedule_tabview_model = new ScheduleTabViewModel();
        private Resource login_account;

        public ScheduleTabViewModel ScheduleTabViewModel
        {
            get { return schedule_tabview_model; }
        }

        public Resource LoginAccount
        {
            get { return login_account; }
            set {
                login_account = value;
                schedule_tabview_model.SetLoginAccount(login_account);
            }
        }

        public bool Logined
        {
            get { return login_account != null; }
        }
        public bool Logouted
        {
            get { return login_account == null; }
        }

        public void RefreshAccount()
        {
            RaisePropertyChanged("Logined");
            RaisePropertyChanged("Logouted");
            RaisePropertyChanged("LoginAccount");
        }

        #region PropertChanged Block
        public event PropertyChangedEventHandler PropertyChanged;

        private void RaisePropertyChanged(string property)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(property));
            }
        }
        #endregion
    }
}
